const express = require('express');
const userHandler = require('../router_handler/user');
// 1. 导入 @escook/express-joi
const expressJoi = require("@escook/express-joi");
// 2. 导入需要的验证规则对象
const { regSchema, loginSchema } = require('../schema/user');
const router = express.Router();
/* GET users listing. */
// router.get('/', function(req, res, next) {
//   res.send('respond with a resource');
// });
// 测试数据库连接
router.get('/test', userHandler.test);
// 注册
router.post('/register', expressJoi(regSchema), userHandler.regUser);

// 登录
router.post('/login',expressJoi(loginSchema), userHandler.login);

// 退出登录
router.post('/logout', userHandler.logout);




module.exports = router;
